package thread;

public class Demo6 {
    public static void main(String[] args) {
        Thread t1=new Thread(()->{
            while (true){
                System.out.println("hello1");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t1");//t1为线程名
        t1.start();

        Thread t2=new Thread(()->{
            while (true){
                System.out.println("hello2");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t2");
        t2.start();

        Thread t3=new Thread(()->{
            while (true){
                System.out.println("hello3");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"我的线程");
        t3.start();
    }
}
